package interview.sharding;

import interview.sharding.jdbc.service.UserService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Startup {
    public static void main(String[] args) throws InterruptedException {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext-db.xml");
        context.start();

        while (true){
            context.getBean(UserService.class).qupdate();
            Thread.sleep(4000);
        }
    }

//        Thread[] threads = new Thread[100];
//        for (int i = 0; i < threads.length; i++) {
//            threads[i] = new Thread(() -> context.getBean(UserService.class).qupdate());
//        }
//        for (Thread t : threads) {
//            t.start();
//        }
//    }
}
